<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
 *      [PinTuXiu] (C)2001-2099 ONightjar.com Pintuxiu.com.
 *      This is NOT a freeware, use is subject to license terms
 */
class itemdetail_db extends Model
{
	public $pk = 'item_id';
	public $table = 'ptx_item_detail';

	function addone($data){
		$attrs = array('item_id','intro','intro_search','reference_url','reference_itemid','reference_channel','promotion_url');
		$insertData = array();
		foreach ($attrs as $attr){
			if($data[$attr]) $insertData[$attr]=$data[$attr];
		}
		return $this->create($insertData);
	}
	
	function findbyid($id){
		return $this->findBy('item_id', $id);
	}
	
	function updateone($itemid,$data){
		$attrs = array('intro','intro_search','reference_url','reference_itemid','reference_channel','promotion_url');
		$insertData = array();
		foreach ($attrs as $attr){
			if($data[$attr]) $insertData[$attr]=$data[$attr];
		}
		return $this->update(array('item_id'=>$itemid),$insertData);
	}

}
